package top.forforever.srb.core.config;

import com.google.common.base.Predicates;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

/**
 * @create: 2023/4/29
 * @Description:
 * @FileName: Swagger2Config
 * @自定义内容：
 */
@Configuration
@EnableSwagger2
public class Swagger2Config {

    @Bean
    public Docket adminDocket() {
        return new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(getAdminApiInfo())
                .groupName("admin")
                .select()
                .paths(Predicates.and(PathSelectors.regex("/admin/core/.*")))
                .build();
    }

    private ApiInfo getAdminApiInfo() {
        return new ApiInfoBuilder()
                .title("尚融宝后台管理系统接口")
                .description("尚融宝后台管理系统接口文档")
                .contact(new Contact("Mr.Jiang","http://test","2929408642@qq.com"))
                .build();
    }

}
